Migrating Content from Music Object 3.1.x to 3.2.x
|
|
Some fairly minor, but nevertheless noteworthy changes have been made to the Music Object API between versions 3.1.x and 3.2.x. Some of these changes may require that your existing sonified code be modified in some small way. To help transition your code to use the 3.2.x (and later) versions of Music Object, this document provides guidelines for easily updating your code.
If your content has been not been authored for a Music Object 3.1.x version, then you should first consult previous sections about migrating your content, starting from the Music Object version your content is currently using and working your way up to version 3.1.x. Once all your content has been migrated to version 3.1.x, then it will be safe to follow the guidelines in this document to upgrade further to version 3.2.x.
|
|
Create a backup of the local versions of any Web sites you wish to update BEFORE you make any of the following changes. This is a wise safety measure.
|
2. Download the Latest Music Object
|
Download the new "music-object.js" file by right-clicking (click-and-hold for Mac users) on the link below and selecting the 'Save Link As...' or 'Save Target As...' option from the pop-up menu. Save the file to your local hard drive.
music-object.js
If this does not work or you do not see a 'Save Link As...' or 'Save Target As...' option in the pop-up, you can also obtain the new "music-object.js" file if you download the latest version of the Beatnik Music Object Documentation. Once you have downloaded and de-archived the documentation, you can find the "music-object.js" file by following these steps...
- Open up the documentation's main folder.
- Then, from inside the documentation's main folder, open up the folder called "web-authoring".
- Inside this folder, you will see a folder called "javascript". This is where the "music-object.js" file is located.
- Copy the file from this location.
IMPORTANT : Be sure NOT to move the "music-object.js" file outside of the "javascript" folder, as this would cause the documentation to not function correctly.
|
3. Replace Your Existing Music Object
|
Now that you have the latest "music-object.js" file, simply replace the existing "music-object.js" file you are using in any and all Web sites that you have authored with interactive Beatnik content.
Although we've provided the backwards compatibility patch, Music Object Patch - Pre 3.2.0, we strongly advocate that you play it safe and just go through the process of updating your code as soon as you start using Music Object 3.2.x. The changes in the Music Object API may not even affect your code, depending on whether or not your code made reliance upon any of the features that have changed. Either way, the best course of action is to religiously follow the steps outlined below on each sonified Web page.
- Open the sonified page(s) in a good text editor
If you have a text editor that can open multiple documents at the same time and perform a search-and-replace procedure through all the currently open documents, this would be ideal. You should open up all documents that have been sonified using the Music Object API into this text editor. If, on the other hand, your text editor cannot open multiple documents, then you will have to repeat this process for each sonified document by loading in the documents one at a time and performing the search-and-replace procedures listed below.
- Determine if You are Using the Debugging Capabilities
You can find out if a sonified document is making use of the debug capabilities provided in Music Object versions earlier than 3.2.0 by doing a text search for any of the items "debugToAlert", "debugToJavaConsole", or "debugToStatus". If any of these items are found in a document, then it means that the document is relying on the debug capabilities that are now provided through the optional Music Object Extension - Debug.
- If Necessary, Source in "music-object-x-debug.js"
If you find that a sonified document is relying on the debug capabilities, you will need to source in the optional JavaScript file "music-object-x-debug.js" in order to still get the benefits of these features. The "music-object-x-debug.js" file must be sourced in after the "music-object.js" file, as follows...
<SCRIPT SRC="music-object.js"></SCRIPT>
<SCRIPT SRC="music-object-x-debug.js"></SCRIPT>
|
Of course, due to the fact that the debugging options were selected by setting static properties of Music, code that is not updated to source in the "music-object-x-debug.js" file but which is using Music Object version 3.2.0 (or higher) will not produce any error messages - the debugging features will simply not be available.
- Modify all uses of "engageAudio"
Perform a search procedure to find each instance of the text "engageAudio". For each instance that you find, be sure to replace the prefixed Music Object instance name with just "Music". For example, "myMusicObject.engageAudio (false)" should be replaced with "Music.engageAudio (false)". If the "engageAudio" method is being used within a "with" statement and there is no instance name prefixing the actual call to the method, then you will have to prefix "Music." to the method. For example, "with (myMusicObject) {stop (); engageAudio (false)}" will have to become "with (myMusicObject) {stop (); Music.engageAudio (false)}".
- Modify all uses of "getReverbType"
Perform a search procedure to find each instance of the text "getReverbType". For each instance that you find, be sure to replace the prefixed Music Object instance name with just "Music". For example, "myMusicObject.getReverbType ()" should be replaced with "Music.getReverbType ()". If the "getReverbType" method is being used within a "with" statement and there is no instance name prefixing the actual call to the method, then you will have to prefix "Music." to the method. For example, "with (myMusicObject) {play (); currentReverb = getReverbType ()}" will have to become "with (myMusicObject) {play (); currentReverb = Music.getReverbType ()}".
- Modify all uses of "setGlobalMute"
Perform a search procedure to find each instance of the text "setGlobalMute". For each instance that you find, be sure to replace the prefixed Music Object instance name with just "Music". For example, "myMusicObject.setGlobalMute (true)" should be replaced with "Music.setGlobalMute (true)". If the "setGlobalMute" method is being used within a "with" statement and there is no instance name prefixing the actual call to the method, then you will have to prefix "Music." to the method. For example, "with (myMusicObject) {stop (); setGlobalMute (true)}" will have to become "with (myMusicObject) {stop (); Music.setGlobalMute (true)}".
- Modify all uses of "setReverbType"
Perform a search procedure to find each instance of the text "setReverbType". For each instance that you find, be sure to replace the prefixed Music Object instance name with just "Music". For example, "myMusicObject.setReverbType (6)" should be replaced with "Music.setReverbType (6)". If the "setReverbType" method is being used within a "with" statement and there is no instance name prefixing the actual call to the method, then you will have to prefix "Music." to the method. For example, "with (myMusicObject) {play (); setReverbType (6)}" will have to become "with (myMusicObject) {play (); Music.setReverbType (6)}".
After performing the above changes to your code, your content will then be Music Object 3.2.x compliant. Under no circumstances should you perform this procedure upon the "music-object.js" file itself - ONLY your sonified documents which source in the "music-object.js" file.
Check your Web site pages locally to ensure that all your content is still working. If possible, use several browser versions in your testing. Do not delete the backup(s) that you made in step 1 until you have uploaded the changes to the online version of your Web site and verified that all your content works online as well. There are some authoring issues that only impact content when it is being served from a Web server. Even if you have tested your content online and are confident everything is peachy, you may still wish to keep the backups hanging around for a week or so, just in case. Sometimes it is not possible to test all possibilities and you may receive reports from Web site visitors saying that things are suddenly amiss with your content. Always play it safe with your Web content.
|
Music Object Patch - Pre 3.2.0
|
For your convenience, Beatnik Inc. is providing a temporary Music Object patch to ease the transition to the new 3.2.x (and higher) versions. All that is necessary is to source in the tiny additional JavaScript file immediately after sourcing in the "music-object.js" file, as follows...
<SCRIPT SRC="music-object.js"></SCRIPT>
<SCRIPT SRC="music-object-p-pre320.js"></SCRIPT>
|
Using this JavaScript file will smooth over the API differences between versions 3.1.x and 3.2.x, and existing code should continue to work without further modification. You can find the "music-object-p-pre320.js" file inside the "javascript" folder of this documentation. If you absolutely need to upgrade to a 3.2.x (or later) version of Music Object because of some new features you need to use in your code, but you don't have the time to immediately make the changes outlined above, then this may be an acceptable temporary solution. However, it is still recommended that you follow the guidelines above for updating your content as soon as possible.
If you are unfamiliar with Music Object extensions, consult the section About Music Object Extensions.